import { createClient } from '@supabase/supabase-js';

const supabase = createClient(
  import.meta.env.VITE_SUPABASE_URL,
  import.meta.env.VITE_SUPABASE_ANON_KEY
);

export const saveCode = async (content: string) => {
  const { data, error } = await supabase
    .from('codes')
    .insert([{ 
      content,
      created_at: new Date().toISOString()
    }]);

  if (error) throw error;
  return data;
}; 